package com.my.feign.config;

import com.atguigu.springcloud.config.YamlConfigFactory;
import feign.Logger;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

//这里由于jar包的包路径不一致 所以单独扫描
@Configuration
@ComponentScan(basePackages = "com.my.feign.**")
//可以在启动类上-但是需要扫描到对应的FeignClient注解
@EnableFeignClients(basePackages = "com.my.feign.**")
@PropertySource( ignoreResourceNotFound = true,encoding = "UTF-8" ,value = "classpath:/defal-feign.yml",factory = YamlConfigFactory.class)
public class FeignConfig {

    public FeignConfig(){
            System.out.println("加载feign成功");
    }

    /*日志配置 -- 同样需要在yml中进行开启 --必须在主工程的yml进行设置
    * none 默认不显示任何日志
    * basic 基础
    * headers 包含头信息
    * full 包含数据  包含头信息
    * */
    @Bean
    Logger.Level feignLoggerLevel(){
        return Logger.Level.FULL;
    }

}
